package org.csmzxy.class2333;
//动物类
class Animal{
    //定义父类的speak()方法
    public void speak(){
        System.out.println("动物发出叫声");
    }
}
//猫类
class Cat extends Animal{
    //重写父类的speak()方法
    @Override
    public void speak(){
        System.out.println("小猫：喵喵……");
    }
}
//狗类
class Dog extends Animal{
    //重写父类的speak()方法
    @Override
    public void speak(){
        System.out.println("小狗：汪汪……");
    }
    public void houseKeep(){
        System.out.println("狗狗会看家");
    }
}
public class example13 {
    public static void main(String[] args) {
        Animal animal1 = new Cat();
        Animal animal2 = new Dog();
        animal1.speak();
        animal2.speak();
    }
}
